package com.xr.blog.controller.front;

import com.xr.blog.pojo.BlogMenu;
import com.xr.blog.service.BlogConfigService;
import com.xr.blog.service.BlogMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

/**
 * 前台监控控制器
 * @author 幸仁杰
 */
@Controller
@RequestMapping("monitor")
public class MonitorController {

    @Autowired
    protected BlogConfigService configService;

    @Autowired
    protected BlogMenuService menuService;
    /**
     * 相册✌跳转
     * @return
     */
    @GetMapping
    public String monitor(Model model) {
        Map<String,String> map=configService.findAllGlobal();
        BlogMenu monitor=menuService.findMonitor();
        List<BlogMenu> menus=menuService.findAllMenu();
        model.addAttribute("GLOBAL",map);
        model.addAttribute("monitor",monitor);
        model.addAttribute("MENUS",menus);
        return "monitor";
    }
}
